#include <bits/stdc++.h>
using namespace std;

// #define int long long
using ll = long long;

const int N = 2e5+10;
ll a[N];
int n;

struct node{
    int val;
    int son[2];
}t[N*32];
int idx; //动态开点

// 2e32 -- intmax?

void insert(int x){
    int o = 0;
    for ( int i=30; i>=0; i-- ){
        int y = x>>i & 1;
        int &u = t[o].son[y];

        if ( u==0 ) u = ++idx;
        o = u;
    }
}

int getmax( int x ){
    int o = 0;
    int res = 0;
    for ( int i=30; i>=0; i-- ){
        int y = x>>i & 1;
        int u = t[o].son[y];
        int v = t[o].son[!y];
        if (v){
            o = v;
            res |= (1<<i);
        } else {
            o = u;
        }
    }
    return res;
}

signed main(){
    cin >> n;
    for ( int i=1; i<=n; i++ ) cin >> a[i];

    insert(a[1]);
    int ans = a[1] ^ a[2];
    for ( int i=2; i<=n; i++ ){
        ans = max(ans,getmax(a[i]));
        insert(a[i]);
    }
    cout << ans << '\n';
}
